package com.projectName.www.service;

import com.projectName.www.dao.OrderDao;
import com.projectName.www.dao.OrderDaoImpl;
import com.projectName.www.dao.UserDao;
import com.projectName.www.dao.UserDaoImpl;
import com.projectName.www.po.Order;
import com.projectName.www.po.User;

import java.util.ArrayList;
import java.util.List;

public class AdminServiceImpl extends UserServiceImpl implements AdminService {

    /**
     * 查看商家、用户、订单
     *修改用户，订单
     *
     * 封禁用户setonline status
     * @return
     */
    //设置商家上线权限
    @Override
    public void setOnlineStatus(String uid,boolean status)
    {
        userDaoImplement.setonlineStatus(uid,status);
    }

    //查看所有商家
    public List<User> findSlr(){
        List<User> userList=new ArrayList<>();
        userDaoImplement = new UserDaoImpl();
        userList=userDaoImplement.findSlr();
        return userList;
    }

    //寻找全部用户


    //通过订单ID查找订单
    @Override
    public Order findOrderByUid(String Uid){
        OrderDao od=new OrderDaoImpl();
        Order byId = od.findById(Uid);
        return byId;
    }



    //通过用户来找订单



    @Override
    public void SetUserStatus(String uid, Boolean status) {
        UserDao us=new UserDaoImpl();
        us.setonlineStatus(uid,status);
    }
}
